import java.util.Scanner;

public class Selflearn_11 {
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int numbera,numberb,gcd=1;
        numbera=in.nextInt();
        numberb=in.nextInt();
        for(int i=2;i<=numbera&&i<=numberb;i++){
            if(numbera%i==0&&numberb%i==0){
                gcd=i;
            }
        }
        System.out.println(numbera+"和"+numberb+"的最大公约数为"+gcd);
    }
}
